package com.liurz.mongdb.controller;

import com.liurz.mongdb.model.Sensor;
import com.liurz.mongdb.service.SensorService;
import com.liurz.mongdb.vo.ResultModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private SensorService sensorService;

    @PostMapping("/save")
    public ResultModel save(@RequestBody Sensor entity){
        return sensorService.save(entity);
    }
    @PostMapping("/getById/{id}")
    public ResultModel getById(@PathVariable("id") String id) {

        return sensorService.getSensorById(id);
    }
}
